var size = 0;
var actsize = 0;
find();
window.addEventListener("focus", find);

function find() {
  if (window == top) {
	var result = document.getElementsByTagName("img");

    var images = [];
	for(var key in result)	{
		if (!isNaN(result[key].width)) {
			actsize = result[key].width * result[key].height;
			if (actsize > size) {
				images.shift();
				images.push(result[key].src);
				size = (result[key].width * result[key].height);
			}
		}
	}

    chrome.extension.connect().postMessage(images);
  }
}
